package com.ygp.asyn.entity;

import lombok.Data;

@Data
public class Result<T> {

    private String msg;
    private String code;
    private boolean success;
    private T obj;

    public static <T> Result<T> build() {
        return new Result<>();
    }

    public static <T> Result<T> success() {
        Result<T> tResult = new Result<>();
        tResult.setCode("200");
        return tResult;
    }

    public static <T> Result<T> fail(String msg) {
        Result<T> tResult = new Result<>();
        tResult.setCode("500");
        tResult.setMsg(msg);
        return tResult;
    }

    public static <T> Result<T> fail() {
        Result<T> tResult = new Result<>();
        tResult.setCode("500");
        return tResult;
    }

}
